package com.Init;


import android.app.Activity;

import com.Managers.FragmentManagerClass;
import com.activities.ActivityMain;
import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu;
import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu.OnCloseListener;
import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu.OnOpenedListener;
import com.shareup.R;


public class SliderClass {

    private final Activity MenuActivity;
    public static SlidingMenu menuMine;
    public static SlidingMenu sMenu;
   

    public SliderClass(Activity menuActivity) {

        super();

        MenuActivity = menuActivity;
      

    }

    public void Create() {

      
    	
        int shadow = R.drawable.shadow;
        sMenu = new SlidingMenu(MenuActivity);
        sMenu.setMode(SlidingMenu.LEFT);

        sMenu.setShadowWidthRes(R.dimen.shadow_width);
        sMenu.setShadowDrawable(shadow);
        sMenu.setBehindOffsetRes(R.dimen.slidingmenu_offset);
        sMenu.setFadeDegree(0.35f);
        sMenu.attachToActivity(MenuActivity, SlidingMenu.SLIDING_CONTENT);
        //
        sMenu.setTouchModeAbove(SlidingMenu.TOUCHMODE_MARGIN);
        sMenu.setMenu(R.layout.menu);
        FragmentManagerClass.sMenu = sMenu;

        sMenu.setOnOpenedListener(new OnOpenedListener() {

            @Override
            public void onOpened() {

            	menuMine.setTouchModeAbove(SlidingMenu.TOUCHMODE_NONE);
                ActivityMain.sMenuOpened = true;

            }
        });
        sMenu.setOnCloseListener(new OnCloseListener() {

            @Override
            public void onClose() {
            	menuMine.setTouchModeAbove(SlidingMenu.TOUCHMODE_MARGIN);
                ActivityMain.sMenuOpened = false;

            }
        });
        
        CreateMineMenu();
    }
    
    public void CreateMineMenu()
    {
    	menuMine = new SlidingMenu(MenuActivity);
    	menuMine.setMode(SlidingMenu.RIGHT);

        int shadow = R.drawable.shadowright;
        menuMine.setShadowWidthRes(R.dimen.shadow_width);
        menuMine.setShadowDrawable(shadow);
        menuMine.setBehindOffsetRes(R.dimen.slidingmenu_offset);
        menuMine.setFadeDegree(0.35f);
        menuMine.attachToActivity(MenuActivity, SlidingMenu.SLIDING_CONTENT);
              
       
        menuMine.setMenu(R.layout.menu_mine);
        
        menuMine.setOnOpenedListener(new OnOpenedListener() {

            @Override
            public void onOpened() {

            	sMenu.setTouchModeAbove(SlidingMenu.TOUCHMODE_NONE);
                ActivityMain.sMenuOpened = true;

            }
        });
        menuMine.setOnCloseListener(new OnCloseListener() {

            @Override
            public void onClose() {
            	
            	sMenu.setTouchModeAbove(SlidingMenu.TOUCHMODE_MARGIN);
                ActivityMain.sMenuOpened = false;

            }
        });
        
       
        
    }
    
    public void createUpload()
    {
    	SlidingMenu uploadMenu = new SlidingMenu(MenuActivity);
    	uploadMenu.setMode(SlidingMenu.RIGHT);

        int shadow = R.drawable.shadowright;
        uploadMenu.setShadowWidthRes(R.dimen.shadow_width);
        uploadMenu.setShadowDrawable(shadow);
        uploadMenu.setBehindOffsetRes(R.dimen.slidingmenu_offset);
        uploadMenu.setFadeDegree(0.35f);
        uploadMenu.attachToActivity(MenuActivity, SlidingMenu.SLIDING_CONTENT);
              
       
        uploadMenu.setMenu(R.layout.menu_mine);
        
      
    }

}
